package com.fq.myapplication.activity;

import android.os.Bundle;
import android.widget.ImageView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.fq.myapplication.R;
import com.fq.myapplication.utils.ThemeManager;

public class LoginActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_login);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        ImageView btnBack = findViewById(R.id.imageView1);
        btnBack.setOnClickListener(v -> {
            finish();
            // 设置退出动画
            overridePendingTransition(R.anim.slide_in_bottom, R.anim.slide_out_top);
        });
        int themeMode = ThemeManager.getThemeMode(this);
        AppCompatDelegate.setDefaultNightMode(themeMode);
    }
}